package com.demo;

import java.util.List;
import java.util.stream.Collectors;

public class UsingStream {
    public static void main(String[] args) {
        List<Apple> inventory = Util.getApples();
        List<Apple> heavyApples =
                inventory.stream().filter((Apple a) -> a.getWeight() > 150).collect(Collectors.toList());
        System.out.println(heavyApples);

        heavyApples = inventory.parallelStream().filter((Apple a) -> a.getWeight() > 150).collect(Collectors.toList());
        System.out.println(heavyApples);
    }
}